<%@ page language="java" import="java.util.*,com.lmpop.trade.ti_attach.*,com.lmpop.trade.uploadFile.*,com.lmpop.frame.util.*,java.io.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
 <% 
	
		
		String attach_root_id = "111",img_type="0",tabShow="0";
		
		if(request.getParameter("attach_root_id")!=null && !request.getParameter("attach_root_id").equals("")){
			attach_root_id = request.getParameter("attach_root_id");
		}
		if(request.getParameter("img_type")!=null && !request.getParameter("img_type").equals("")){
			img_type = request.getParameter("img_type");
		}
		if(request.getParameter("tabShow")!=null && !request.getParameter("tabShow").equals("")){
			tabShow = request.getParameter("tabShow");
		}

		Config conf = new Config();
		Ti_attachInfo attachInfo = new Ti_attachInfo();	
		Hashtable suoMap = new Hashtable();
	    suoMap.put("attach_root_id",attach_root_id);	
	    suoMap.put("file_type","0");
	    String imgpath = "",dis_img="",suo_attach_id="";	
	    List suoList = attachInfo.getAttachInfoByMap(suoMap);
		
	
		
	%>
<html>
<head>
<title>图片上传</title>
<link  href="/program/plugins/upload/uploadImg/css.css" rel="stylesheet"  type="text/css" />
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/program/plugins/upload/uploadImg/upload.js"></script>
<script type="text/javascript">
      
	  $(document).ready(function(){
	  //alert('<%=tabShow%>');
		  $(".tab_content").hide();
		  $("ul.tabs li:first").addClass("active").show();
		  $(".tab_content:first").show();
		  $("ul.tabs li").click(function(){
				   $("ul.tabs li").removeClass("active");
				   $(this).addClass("active");
				   $(".tab_content").hide();
				   var activeTab = $(this).find("a").attr("href");
				   $(activeTab).fadeIn();
				   return false;
		  });
    
});
</script>


</head>

<body>
 <div class="top">
     <div class="sc"><a href="#"><img src="/program/plugins/upload/uploadImg/images/wz_03.jpg" /></a></div>
 </div>
<hr/>

	
	<div class="w990">
	
	<ul class="tabs">
 
	<li><a href="#tab1">上传缩略图</a></li>
 
 
 	<%if(img_type.equals("1")){ %>

	
	<li><a href="#tab2">上传商品展示图</a></li>
 
 
    <%} %>

 
</ul>
 

 <%if(suoList!=null && suoList.size()>0){ %>

     &nbsp;<input type="button" value="确认上传" onclick="closeNotTip()" class="butcss"/>
 
 <%} %>


<div class="tab_container">

<div id="tab1" class="tab_content">
 
 

  
  <div style="margin-top:10px;"></div>  
  
 
   <form name="uploadform" method="POST" action="/servlet/uploadImg" ENCTYPE="multipart/form-data">
			<table width="100%" border=0 cellpadding=2 cellspacing=2 align=left >
				<tr>
					<td width="15%" style="border:1px solid #D1DDED;" align="center">
						
						<%
						   
						   if(suoList!=null && suoList.size()>0)
						   {
						      Hashtable soMap = (Hashtable)suoList.get(0);
				              if(soMap.get("file_path")!=null) imgpath= soMap.get("file_path").toString();
							  if(soMap.get("attach_id")!=null) suo_attach_id= soMap.get("attach_id").toString();
						   }
						 					
                           if(!imgpath.equals("")){
								dis_img = "<img src="+imgpath+"  width=272 height=290 />";
						   }else{
								dis_img = "<img src=/program/plugins/upload/uploadImg/images/cpwu.gif  width=272 height=290 />";	
						   }
							
							out.println("<div id=imgUploadDiv >"+dis_img+"</div>");
							
							if(!imgpath.equals("")){
								out.println("<div id=delWordDiv ><a href='/doTradeReg.do?pkid="+suo_attach_id+"&bpm_id=5712&file_path="+imgpath+"' >删除</a>   &nbsp;<a href='"+imgpath+"' target='_blank'>原图</a></div>");
							}
						%>
						
				  </td>

            <td style="font-size:12px;" valign="top">
                     <% if(suoList==null  || suoList.size()==0){ %>
					  
					  <input name="minfile" id="minfile" size="40" type="file">
					  
	                  <div style="margin-top:8px"></div>
					  
					  图片格式限制:&nbsp;<font color="#303A43"><%=conf.getString("imagesext")%>;</font><br/>
                         图片大小限制:&nbsp;<font color="#303A43">请根据前台页面的显示上传宽，高合适的图片</font>
					  <div style="margin-top:8px"></div>
			          <input name="formSub" value="上 传"  type="button"  class="butcss"  onclick="uploudImg('0')"/>
					<%}%>
					</td>
				</tr>
				
			</table>
				<input type="hidden" name="attach_root_id" value="<%=attach_root_id%>" />
			
		
		</form>
                    
</div>


<div id="tab2" class="tab_content">
      
 <div class="content">
     	
	 <% 
					

	  			 Hashtable dxMap = new Hashtable();
				 dxMap.put("attach_root_id",attach_root_id);	
				 dxMap.put("file_type","2");							   
				 List aList = attachInfo.getAttachInfoByMap(dxMap);
				 String one_file_path="/program/plugins/upload/uploadImg/images/cpwu.gif",one_attach_id="";
				 if(aList!=null && aList.size()>0)
				 {
	  					Hashtable oneMap = (Hashtable)aList.get(0);
	  					if(oneMap.get("attach_id")!=null) one_attach_id = oneMap.get("attach_id").toString();
	  					if(oneMap.get("file_path")!=null) one_file_path = oneMap.get("file_path").toString();
						if(one_file_path.equals(""))
						{
						  one_file_path = "/program/plugins/upload/uploadImg/images/cpwu.gif";
						}
						
	  			}		
	  					
	  		%>	
	 
	 
	 
   
    <div class="left" style="width:420px;height:272px;">
	       <img src="<%=one_file_path%>" id="one_file_path" width="420" height="272" />
	</div>
	  
	  
	  
	  <div class="center" id=demo>
	  	
	  		<div id=demo1> 
            
		<% 
					
				 int listsize=0;
				 if(aList!=null && aList.size()>0){
	  				listsize = aList.size();
	  				Hashtable aMap = new Hashtable();
	  				for(int i=0;i<aList.size();i++){
	  					aMap = (Hashtable)aList.get(i);
	  					String attach_id = "",file_path = "",attach_name="";
	  					if(aMap.get("attach_id")!=null) attach_id = aMap.get("attach_id").toString();
	  					if(aMap.get("file_path")!=null) file_path = aMap.get("file_path").toString();
						if(aMap.get("attach_name")!=null) attach_name = aMap.get("attach_name").toString();
						if(file_path.equals(""))
						{
						  file_path = "/program/plugins/upload/uploadImg/images/cpwu.gif";
						}
						
	  					
	  					
	  		%>
			 
	  		
	  		<img src="<%=file_path %>" onmouseout="levelImage(this)" onmouseover="showImage(this)" width="65" height="65"/>
	  		<a href="/doTradeReg.do?pkid=<%=attach_id%>&bpm_id=5712&file_path=<%=file_path%>">删除</a>
	  		<a href="<%=file_path%>">原图</a>
	  		<%
	  				}
	  			}
	  		%>
			</div> 
			<div id=demo2>
				<% 
				dxMap.put("attach_root_id",attach_root_id);	
				 dxMap.put("file_type","3");							   
				 aList = attachInfo.getAttachInfoByMap(dxMap);
				  one_file_path="/program/plugins/upload/uploadImg/images/cpwu.gif";
				  one_attach_id="";
				 if(aList!=null && aList.size()>0)
				 {
	  					Hashtable oneMap = (Hashtable)aList.get(0);
	  					if(oneMap.get("attach_id")!=null) one_attach_id = oneMap.get("attach_id").toString();
	  					if(oneMap.get("file_path")!=null) one_file_path = oneMap.get("file_path").toString();
						if(one_file_path.equals(""))
						{
						  one_file_path = "/program/plugins/upload/uploadImg/images/cpwu.gif";
						}
						
	  			}		
				 listsize=0;
				 if(aList!=null && aList.size()>0){
	  				listsize = aList.size();
	  				Hashtable aMap = new Hashtable();
	  				for(int i=0;i<aList.size();i++){
	  					aMap = (Hashtable)aList.get(i);
	  					String attach_id = "",file_path = "",attach_name="";
	  					if(aMap.get("attach_id")!=null) attach_id = aMap.get("attach_id").toString();
	  					if(aMap.get("file_path")!=null) file_path = aMap.get("file_path").toString();
						if(aMap.get("attach_name")!=null) attach_name = aMap.get("attach_name").toString();
						if(file_path.equals(""))
						{
						  file_path = "/program/plugins/upload/uploadImg/images/cpwu.gif";
						}
						
	  					
	  					
	  		%>
			 
	  		
	  		<img src="<%=file_path %>" onmouseout="levelImage(this)" onmouseover="showImage(this)" width="65" height="65"/>
	  		<a href="/doTradeReg.do?pkid=<%=attach_id%>&bpm_id=5712&file_path=<%=file_path%>">删除</a>
	  		<a href="<%=file_path%>">原图</a>
	  		<%
	  				}
	  			}
	  		%>
			</div> 
		</div> 

	  <div class="right">
	  
	  
	
	  	
	  	 <form action="/servlet/uploadImg" enctype="multipart/form-data" method="post" name="goodsForm">
	  	 	
	  	 	<input type="hidden" name="attach_root_id" value="<%=attach_root_id%>" />
	  	 	
		     <div class="right_t" id="uploadDiv">
			      
			      大图:<input type="file" name="bigfile1" id="bigfile1" size="25">
				  <div style="margin-top:8px"></div>
			     <!--  小图:<input type="file" name="smallfile1" id="smallfile1" size="35">
                  <div style="margin-top:8px"></div> -->
				  图片格式限制:&nbsp;<font color="#303A43"><%=conf.getString("imagesext")%>;</font>
				  <div style="margin-top:8px"></div>
				  <img src="/program/images/bullet_error.png" border=0 />请您上传相应大小的图片，否则将影响前台的展示！
			   	  <div style="margin-top:8px"></div>
				  大图大小限制:&nbsp;<font color="#303A43">宽<%=conf.getString("img_big_width")%>px，高<%=conf.getString("img_big_height")%>px;</font>			   		
<!-- 			   	  小图大小限制:&nbsp;<font color="#303A43">宽<%=conf.getString("img_small_width")%>px，高<%=conf.getString("img_small_height")%>px;</font> -->
			      <div style="margin-top:8px"></div>
			     
				  <input name="formSub" value="上 传"  type="button"  class="butcss"  onclick="uploudImg('1')"/>
				  
				  
				  <input type="hidden" value="1"  name="upload_num" id="upload_num" />
                   <input type="hidden" name ="tabShow" value="1">
			  
			   </div>

			   
			   <div class="right_d">
 
			   	<div class="rightDspan">

			 	</div>
			   	<br/>
			   	
			   </div> 
			   <input type="hidden" value="<%=conf.getString("imagesext")%>"  name="imagesext" id="imagesext" />
			  

		  	</form>

		  	
	  </div>
   </div>

   
</div>

</div> 
</div>

 <form action="/doTradeReg.do" method="post" name="DXform">
     <input type="hidden" name ="pkid_path" id="pkid_path" value="">
     <input type="hidden" name ="bpm_id" value="2369">
	 <input type="hidden" name ="tabShow" value="1">
	  	<input type="checkbox" id="share" name="share" style="display:none">
 </form>
  
</body>
</html>
<script> 
if(<%=listsize%> > 4)
{
	var speed=30 
	demo2.innerHTML=demo1.innerHTML;
	function Marquee(){ 
		if(demo2.offsetTop-demo.scrollTop<=0) 
			demo.scrollTop-=demo1.offsetHeight 
		else{ 
			demo.scrollTop++;
		}
	}
	var MyMar=setInterval(Marquee,speed) 
	demo.onmouseover=function() {clearInterval(MyMar)} 
	demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)} 
}
</script>  